<?php
  ini_set('session.gc_max_lifetime', 900);
  ini_set('session.gc_probability', 1);
  ini_set('session.gc_divisor', 1);
  session_start();
  

  if (!isset($_SESSION['user'])) {
    header("Location:login.html");
    die();
    }
?>
<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="utf-8" />
      <title>GARMOR</title>
      <!-- don't forget to paste your page title! -->
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      <meta name="description" content="" />
      <meta name="author" content="" />
      <!-- Le styles -->

      <!-- Bootstrap styles for responsive website layout, supporting different screen sizes -->
      <!-- Bootstrap CSS fixes for IE6 -->
      <!--[if lt IE 7]><link rel="stylesheet" href="http://blueimp.github.io/cdn/css/bootstrap-ie6.min.css"><![endif]-->
      <!-- Bootstrap Image Gallery styles -->
      <link rel="stylesheet" href="http://blueimp.github.io/Bootstrap-Image-Gallery/css/bootstrap-image-gallery.min.css">
      <!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
      <link rel="stylesheet" href="css/jquery.fileupload-ui.css">
      <!-- CSS adjustments for browsers with JavaScript disabled -->
      <noscript><link rel="stylesheet" href="css/jquery.fileupload-ui-noscript.css"></noscript>
      <!-- bootstrap framework styles -->
      <link href="css/bootstrap.css" rel="stylesheet" />
      <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
      <!-- fancybox lightbox clone plugin styles -->
      <link href="css/fancybox.css" rel="stylesheet" />
      <!-- icomoon icons font  -->
      <link href="css/icomoon.css" rel="stylesheet" />
      <!-- sequence slider styles -->
      <!--[if lt IE 8]>
      <link rel="stylesheet" type="text/css" media="screen" href="css/sequencejs_ie.css" />
      <![endif]-->
      <link rel="stylesheet" type="text/css" media="screen" href="css/sequencejs.css" />
      <!-- main template styles -->
      <link href="css/styles.css" rel="stylesheet" />
      <!-- place for your custom styles -->
      <link href="css/mystyle.css" rel="stylesheet" />
      <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
      <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
      <![endif]-->
   </head>
   <body class="">
      <!-- Backround image. Just paste yours. No extra code. Highly recommend to use your own images -->
      <!-- background images by Victor1558 under CC BY 2.0 license -> http://www.flickr.com/photos/76029035@N02/ -->
      <img src="img/bg14.jpg" id="bg_main" alt="" />
      <!--recommended image dimentions 1200x800px with weight under 120kb 
         !note! don't use very light images. It can damage readability of the white text -->
      <div class="container">
        <div class="row">
            <div class="span12">
               <div class="navbar">
                 
               </div>
            </div>
         </div>
         <a id="newproject" href="#myModal" role="button" class="btn" data-toggle="modal"><i class="icon-plus"></i>Nuevo proyecto</a>
           
          <div id="gridTable">

          </div>
      </div>
 
      <!-- Modal -->
      <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width:710px;color:#585858">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
          <h3 id="myModalLabel">Registrar nuevo proyecto</h3>
        </div>
      <div class="modal-body">
          <form class="fileupload" action="server/php/" method="POST" enctype="multipart/form-data">
           <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
           <div class="row">
               <div class="span7">
                   <label for="projectName">
                       Nombre del proyecto
                   </label>
                   <input id="projectName" name="projectName" type="text"/>
               </div>
               <div class="span7">
                   <label for="projectDescription">
                       Descripci&oacute;n del proyecto
                   </label>
                   
                   <textarea id="projectDescription" style="width:500px;height:200px;" name="projectDescription"></textarea>
                   
                   <label for="datePickerBefore">
                    Fecha de inicio
                   </label>
                   
                   <input type="text" name="datePickerBefore" id="datePickerBefore" class="small" readonly="readonly"/>
                   
                   <label for="datePickerAfter">
                    Fecha de terminaci&oacute;n
                   </label>
                   
                   <input type="text" name="datePickerAfter" id="datePickerAfter" class="small" readonly="readonly"/>
               </div>
           </div>
           <div class="row fileupload-buttonbar">
               <div class="span7">
                   <!-- The fileinput-button span is used to style the file input field as button -->
                   <span class="btn btn-success fileinput-button">
                       <i class="icon-plus"></i>
                       <span>Cargar im&aacute;genes</span>
                       <input id="primaryFiles" type="file" name="files[]" multiple>
                   </span>
                   <button class="btn btn-primary start" style="display: none;">
                       <i class="icon-upload icon-white"></i>
                       <span></span>
                   </button>
                   <!--
                   <button type="reset" class="btn btn-warning cancel">
                       <i class="icon-ban-circle icon-white"></i>
                       <span>Cancel upload</span>
                   </button>
                   <button type="button" class="btn btn-danger delete">
                       <i class="icon-trash icon-white"></i>
                       <span>Delete</span>
                   </button>
                   <input type="checkbox" class="toggle">
                   -->
                   <!-- The loading indicator is shown during file processing -->
                   <span class="fileupload-loading"></span>
               </div>
               <!-- The global progress information -->
               <div class="span5 fileupload-progress fade">
                   <!-- The global progress bar -->
                   <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
                       <div class="bar" style="width:0%;"></div>
                   </div>
                   <!-- The extended global progress information -->
                   <div class="progress-extended">&nbsp;</div>
               </div>
           </div>
           <!-- The table listing the files available for upload/download -->
           <table role="presentation" class="table">
            <tbody id="primaryRows" class="files" data-toggle="modal-gallery" data-target="#modal-gallery">
              <tr class="trheader">
                <th>Vista previa</th>
                <th>Secci&oacute;n</th>
                <th>Portada</th>
                <th></th>
              </tr>
            </tbody>
           </table>
            <!--
            <span class="btn btn-primary submitdata">
               <i class="icon-upload icon-white"></i>
               <span>Registrar proyecto</span>
            </span>
          -->
         </form>
<!--
         <form class="fileupload" action="server/php/upload_file.php" method="POST" enctype="multipart/form-data">
            <input id="secondaryFiles" type="file" name="files[]" multiple>

           <table role="presentation" class="table">
            <tbody id="secondaryRows" class="files" data-toggle="modal-gallery" data-target="#modal-gallery">
              <tr class="trheader">
                <th>Vista previa</th>
                <th>Secci&oacute;n</th>
                <th>Portada</th>
                <th></th>
              </tr>
            </tbody>
           </table>
         </form>
       -->
      </div>
        <div class="modal-footer">
          <div id="errorMessage" class="alert alert-danger" style="float: left; display: none;">
            
          </div>
          <button class="btn" data-dismiss="modal" aria-hidden="true">Cerrar</button>
          <button class="btn btn-primary submitdata"><i class="icon-upload icon-white"></i>Registrar proyecto</button>
          <button class="btn btn-primary updatedata hidden"><i class="icon-upload icon-white"></i>Guardar proyecto</button>
        </div>
      </div>

        <div id="deleteDialog" title="Eliminar" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="deleteMessage" aria-hidden="true" style="color:#585858" >
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
              <h5 id="deleteMessage">Desea eliminar el proyecto:</h5>
            </div>
            <div class="modal-footer">
              <button id="no" class="btn" data-dismiss="modal" aria-hidden="true">No</button>
              <button id="yes" class="btn btn-primary"><i class="icon-upload icon-white"></i>Si</button>
            </div>
        </div>

      <!-- /container --><!-- Le javascript
         ================================================== -->
      <!-- Placed at the end of the document so the pages load faster -->
      <!-- The template to display files available for upload -->
      <script id="template-upload" type="text/x-tmpl">
      {% for (var i=0, file; file=o.files[i]; i++) { %}
          <tr class="template-upload">
              <td>
                  <span class="preview">
                    {% if (file.thumbnail_url) { %}
                      <a href="{%=file.url%}" data-gallery="gallery"> <img src="{%=file.thumbnail_url%}"></a>
                    {% } %}
                  </span>
              </td>
              <td>
                  <select class="section small">
                    <option value="0">Antes</option>
                    <option value="1">Despu&eacute;s</option>
                  </select>
              </td>
              <td style="display:none;">
                      <button class="btn btn-primary start">
                          <i class="icon-upload icon-white"></i>
                          <span>Start</span>
                      </button>
              </td>
              <td>
                {% if($('.files > tr > td > input[type=radio]:checked').length == 0){ %}
                  <input type="radio" name="principal" value="principal" style="margin-top:-4px;" checked> <br>
                {% } else { %}
                  <input type="radio" name="principal" value="principal" style="margin-top:-4px;"> <br>
                {% } %}
              </td>
              <td>
                  <button class="btn btn-danger delete deleteImageRow">
                      <i class="icon-trash icon-white"></i>
                      <span>Borrar</span>
                  </button>
              </td>
              {% if (file.id) { %}
              <td>
                  <input type="hidden" value="{%=file.id%}" />
              </td>
              {% } %}

          </tr>
      {% } %}
      {% 
        setTimeout(
          function(){
            $(".deleteImageRow").click(function(e){
              $(e.currentTarget).parent().parent().remove(); 
            });
          }, 1000);
       %}
      </script>
      <!-- The template to display files available for download -->
      <script id="template-download" type="text/x-tmpl">

      
      </script>
      <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
      <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
      <script src="js/vendor/jquery.ui.widget.js"></script>
      <script src="http://blueimp.github.io/JavaScript-Templates/js/tmpl.min.js"></script>
      <script src="http://blueimp.github.io/JavaScript-Load-Image/js/load-image.min.js"></script>
      <script src="http://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script>
      <script src="http://blueimp.github.io/cdn/js/bootstrap.min.js"></script>
      <script src="http://blueimp.github.io/Gallery/js/blueimp-gallery.min.js"></script>
      <script src="js/jquery.iframe-transport.js"></script>
      <script src="js/jquery.fileupload.js"></script>
      <script src="js/jquery.fileupload-process.js"></script>
      <script src="js/jquery.fileupload-image.js"></script>
      <script src="js/jquery.fileupload-audio.js"></script>
      <script src="js/jquery.fileupload-video.js"></script>
      <script src="js/jquery.fileupload-validate.js"></script>
      <script src="js/jquery.fileupload-ui.js"></script>
      <!-- The main application script -->
      <script src="js/main.js"></script>
      <script src="js/Grid.js"></script>
      <script src="js/main-projects.js"></script>
      <script> $(function() { $('.carousel').carousel() }); </script>
      <script type="text/javascript">
         $("[rel=tooltip]").tooltip();
      </script>
      <!-- plugin for background images -->
      <script src="js/bg_image.js"></script>

      <script type="text/javascript" src="js/navbarAdmin.js"></script>
      <script type="text/javascript">
        $(function(){
            $(".register").addClass('active');
            $("#datePickerBefore" ).datepicker();

            $( "#datePickerAfter" ).datepicker();
        });

        function logout(){
          location.href = '../php/logout.php';
        }
      </script>
   </body>
</html>